package edu.netjava.swing;

import java.awt.Color;
import java.awt.ComponentOrientation;
import java.awt.Cursor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.WindowConstants;

public class JFrameTest {
	
	private static final ComponentOrientation ComponentOrientation = null;



	public static void main(String[] args){
		JFrameTest jft = new JFrameTest();
		jft.init();
	}
	
	
	
	public void init(){
		javax.swing.JFrame jsf = new javax.swing.JFrame("MyFrame");
		jsf.setSize(550, 320);
		jsf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
		jsf.setVisible(true);
		jsf.setLocation(320, 240);


		
		
		ActionListener al = new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				processEvent(e);
				
			}

			private void processEvent(ActionEvent e) {
				String s = jte.getText();
				j1.setText(s);
				String es = e.getActionCommand();
				jte.setText(es);
				jte.setName("dkeialjdlaoijsadfkljas");
				
				
				
			}


		};
		
		 j1 = new javax.swing.JLabel("Label 1");
		jsf.add(j1);
		
		jte = new javax.swing.JTextField(10);
		jsf.add(jte);
			
		 
		jb1 = new javax.swing.JButton("button1");
		jb1.addActionListener(al);
		jsf.add(jb1);

		javax.swing.JButton jb2 = new javax.swing.JButton("button2");
		jsf.add(jb2);
		

		
		
		
		java.awt.FlowLayout flow1 = new java.awt.FlowLayout();
		jsf.setLayout(flow1);
	
		

		

		
		
		javax.swing.JTree jtr = new javax.swing.JTree();
		jsf.add(jtr);
		jsf.setName("dslkfj");
		
		jsf.setBackground(Color.blue);
		
//		jsf.setCursor(Cursor.SE_RESIZE_CURSOR);
		
		
		
		
		

	

		
	}
	javax.swing.JLabel j1;
	javax.swing.JButton jb1;
	javax.swing.JTextField jte;

}
